home *** CD-ROM | disk | FTP | other *** search
- #!/bin/sh
- file=snap.rgb
- sleep=0
- noborder=false
- verbose=false
- while test $# -gt 0
- do
- case "$1" in
- -s) sleep=$2
- shift ;;
- -n) noborder=true ;;
- -v) verbose=true ;;
- *) file=$1 ;;
- esac
- shift
- done
- if $noborder
- then
- left=0
- right=0
- top=0
- bottom=0
- else
- left=5
- right=5
- top=29
- bottom=5
- fi
- echo Screen snap will occur in $sleep seconds after mouse click
- cmd=`(echo $left $right $top $bottom ; xwininfo) |
- awk '\
- NR==1{left=$1;right=$2;top=$3;bottom=$4}
- $0~/Absolute upper-left X:/{ux=$4}
- $0~/Absolute upper-left Y:/{uy=$4}
- $0~/Width:/{width=$2}
- $0~/Height:/{height=$2}
- END{print "scrsave '"$file"'",ux-bottom,ux+width-1+left,1024-(uy+height)-bottom,1023-uy+top}'`
- $verbose && echo $cmd
- (if test $sleep -gt 0
- then
- (sleep $sleep ; echo '' ; sh -c "$cmd")
- else
- sh -c "$cmd"
- fi)
- echo Saved file as $file
-